<div xmlns:ext="http://www.extjs.com" class="body-wrap"><div class="inheritance res-block"><pre class="res-block-inner"><a href="output/Ext.data.DataReader.html" ext:member="" ext:cls="Ext.data.DataReader">DataReader</a>
  <img src="resources/elbow-end.gif">XmlReader</pre></div><h1>Class <a href="source/XmlReader.html#cls-Ext.data.XmlReader">Ext.data.XmlReader</a></h1><table cellspacing="0"><tr><td class="label">Package:</td><td class="hd-info">Ext.data</td></tr><tr><td class="label">Defined In:</td><td class="hd-info"><a href="source/XmlReader.html#cls-Ext.data.XmlReader">XmlReader.js</a></td></tr><tr><td class="label">Class:</td><td class="hd-info"><a href="source/XmlReader.html#cls-Ext.data.XmlReader">XmlReader</a></td></tr><tr><td class="label">Extends:</td><td class="hd-info"><a href="output/Ext.data.DataReader.html" ext:cls="Ext.data.DataReader" ext:member="">DataReader</a></td></tr></table><div class="description"><p>Data reader class to create an Array of <a href="output/Ext.data.Record.html" ext:cls="Ext.data.Record">Ext.data.Record</a> objects from an XML document
based on mappings in a provided <a href="output/Ext.data.Record.html" ext:cls="Ext.data.Record">Ext.data.Record</a> constructor.</p>
<p><b>Note</b>: that in order for the browser to parse a returned XML document, the Content-Type
header in the HTTP response must be set to "text/xml" or "application/xml".</p>
<p>Example code:</p>
<pre><code><b>var</b> Employee = Ext.data.Record.create([
   {name: <em>'name'</em>, mapping: <em>'name'</em>},     <i>// <em>"mapping"</em> property not needed <b>if</b> it is the same as <em>"name"</em></i>
   {name: <em>'occupation'</em>}                 <i>// This field will use <em>"occupation"</em> as the mapping.</i>
]);
<b>var</b> myReader = <b>new</b> Ext.data.XmlReader({
   totalProperty: <em>"results"</em>, <i>// The element which contains the total dataset size (optional)</i>
   record: <em>"row"</em>,           <i>// The repeated element which contains row information</i>
   idProperty: <em>"id"</em>         <i>// The element within the row that provides an ID <b>for</b> the record (optional)</i>
   messageProperty: <em>"msg"</em>   <i>// The element within the response that provides a user-feedback message (optional)</i>
}, Employee);</code></pre>
<p>
This would consume an XML file like this:
<pre><code>&lt;?xml version=<em>"1.0"</em> encoding=<em>"UTF-8"</em>?>
&lt;dataset>
 &lt;results>2&lt;/results>
 &lt;row>
   &lt;id>1&lt;/id>
   &lt;name>Bill&lt;/name>
   &lt;occupation>Gardener&lt;/occupation>
 &lt;/row>
 &lt;row>
   &lt;id>2&lt;/id>
   &lt;name>Ben&lt;/name>
   &lt;occupation>Horticulturalist&lt;/occupation>
 &lt;/row>
&lt;/dataset></code></pre></div><div class="hr"></div><a id="Ext.data.XmlReader-configs"></a><h2>Config Options</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Config Options</th><th class="msource-header">Defined By</th></tr><tr class="config-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.DataReader-fields"></a><b><a href="source/DataReader.html#cfg-Ext.data.DataReader-fields">fields</a></b> : Array/Object<div class="mdesc"><div class="short">Either an Array of Field definition objects (which
will be passed to Ext.data.Record.create, or a Record
constructor ...</div><div class="long"><p>Either an Array of <a href="output/Ext.data.Field.html" ext:cls="Ext.data.Field">Field</a> definition objects (which
will be passed to <a href="output/Ext.data.Record.html#Ext.data.Record-create" ext:member="create" ext:cls="Ext.data.Record">Ext.data.Record.create</a>, or a <a href="output/Ext.data.Record.html" ext:cls="Ext.data.Record">Record</a>
constructor created from <a href="output/Ext.data.Record.html#Ext.data.Record-create" ext:member="create" ext:cls="Ext.data.Record">Ext.data.Record.create</a>.</p></div></div></td><td class="msource"><a href="output/Ext.data.DataReader.html#fields" ext:member="#fields" ext:cls="Ext.data.DataReader">DataReader</a></td></tr><tr class="config-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.XmlReader-idPath"></a><b><a href="source/XmlReader.html#cfg-Ext.data.XmlReader-idPath">idPath</a></b> : String<div class="mdesc">The DomQuery path relative from the record element to the element that contains
a record identifier value.</div></td><td class="msource">XmlReader</td></tr><tr class="config-row  inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.DataReader-messageProperty"></a><b><a href="source/DataReader.html#cfg-Ext.data.DataReader-messageProperty">messageProperty</a></b> : String<div class="mdesc">[undefined] Optional name of a property within a server-response that represents a user-feedback message.</div></td><td class="msource"><a href="output/Ext.data.DataReader.html#messageProperty" ext:member="#messageProperty" ext:cls="Ext.data.DataReader">DataReader</a></td></tr><tr class="config-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.XmlReader-record"></a><b><a href="source/XmlReader.html#cfg-Ext.data.XmlReader-record">record</a></b> : String<div class="mdesc">The DomQuery path to the repeated element which contains record information.</div></td><td class="msource">XmlReader</td></tr><tr class="config-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.XmlReader-record"></a><b><a href="source/XmlReader.html#cfg-Ext.data.XmlReader-record">record</a></b> : String<div class="mdesc">The DomQuery path to the repeated element which contains record information.</div></td><td class="msource">XmlReader</td></tr><tr class="config-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.XmlReader-successProperty"></a><b><a href="source/XmlReader.html#cfg-Ext.data.XmlReader-successProperty">successProperty</a></b> : String<div class="mdesc">The DomQuery path to the success attribute used by forms.</div></td><td class="msource">XmlReader</td></tr><tr class="config-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.XmlReader-totalProperty"></a><b><a href="source/XmlReader.html#cfg-Ext.data.XmlReader-totalProperty">totalProperty</a></b> : String<div class="mdesc"><div class="short">The DomQuery path from which to retrieve the total number of records
in the dataset. This is only needed if the whole...</div><div class="long">The DomQuery path from which to retrieve the total number of records
in the dataset. This is only needed if the whole dataset is not passed in one go, but is being
paged from the remote server.</div></div></td><td class="msource">XmlReader</td></tr></tbody></table><a id="Ext.data.XmlReader-props"></a><h2>Public Properties</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Property</th><th class="msource-header">Defined By</th></tr><tr class="property-row  inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.DataReader-buildExtractors"></a><b><a href="source/DataReader.html#prop-Ext.data.DataReader-buildExtractors">buildExtractors</a></b> : Object<div class="mdesc">Abstract method, overridden in DataReader extensions such as <a href="output/Ext.data.JsonReader.html" ext:cls="Ext.data.JsonReader">Ext.data.JsonReader</a> and <a href="output/Ext.data.XmlReader.html" ext:cls="Ext.data.XmlReader">Ext.data.XmlReader</a></div></td><td class="msource"><a href="output/Ext.data.DataReader.html#buildExtractors" ext:member="#buildExtractors" ext:cls="Ext.data.DataReader">DataReader</a></td></tr><tr class="property-row  inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.DataReader-extractValues"></a><b><a href="source/DataReader.html#prop-Ext.data.DataReader-extractValues">extractValues</a></b> : Object<div class="mdesc">Abstract method overridden in DataReader extensions such as <a href="output/Ext.data.JsonReader.html" ext:cls="Ext.data.JsonReader">Ext.data.JsonReader</a> and <a href="output/Ext.data.XmlReader.html" ext:cls="Ext.data.XmlReader">Ext.data.XmlReader</a></div></td><td class="msource"><a href="output/Ext.data.DataReader.html#extractValues" ext:member="#extractValues" ext:cls="Ext.data.DataReader">DataReader</a></td></tr><tr class="property-row  inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.DataReader-getId"></a><b><a href="source/DataReader.html#prop-Ext.data.DataReader-getId">getId</a></b> : Object<div class="mdesc">Abstract method created in extension's buildExtractors impl.</div></td><td class="msource"><a href="output/Ext.data.DataReader.html#getId" ext:member="#getId" ext:cls="Ext.data.DataReader">DataReader</a></td></tr><tr class="property-row  inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.DataReader-getMessage"></a><b><a href="source/DataReader.html#prop-Ext.data.DataReader-getMessage">getMessage</a></b> : Object<div class="mdesc">Abstract method created in extension's buildExtractors impl.</div></td><td class="msource"><a href="output/Ext.data.DataReader.html#getMessage" ext:member="#getMessage" ext:cls="Ext.data.DataReader">DataReader</a></td></tr><tr class="property-row  inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.DataReader-getRoot"></a><b><a href="source/DataReader.html#prop-Ext.data.DataReader-getRoot">getRoot</a></b> : Object<div class="mdesc">Abstract method created in extension's buildExtractors impl.</div></td><td class="msource"><a href="output/Ext.data.DataReader.html#getRoot" ext:member="#getRoot" ext:cls="Ext.data.DataReader">DataReader</a></td></tr><tr class="property-row  inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.DataReader-getSuccess"></a><b><a href="source/DataReader.html#prop-Ext.data.DataReader-getSuccess">getSuccess</a></b> : Object<div class="mdesc">Abstract method created in extension's buildExtractors impl.</div></td><td class="msource"><a href="output/Ext.data.DataReader.html#getSuccess" ext:member="#getSuccess" ext:cls="Ext.data.DataReader">DataReader</a></td></tr><tr class="property-row  inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.DataReader-getTotal"></a><b><a href="source/DataReader.html#prop-Ext.data.DataReader-getTotal">getTotal</a></b> : Object<div class="mdesc">Abstract method created in extension's buildExtractors impl.</div></td><td class="msource"><a href="output/Ext.data.DataReader.html#getTotal" ext:member="#getTotal" ext:cls="Ext.data.DataReader">DataReader</a></td></tr><tr class="property-row  inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.DataReader-meta"></a><b><a href="source/DataReader.html#prop-Ext.data.DataReader-meta">meta</a></b> : Mixed<div class="mdesc">This DataReader's configured metadata as passed to the constructor.</div></td><td class="msource"><a href="output/Ext.data.DataReader.html#meta" ext:member="#meta" ext:cls="Ext.data.DataReader">DataReader</a></td></tr><tr class="property-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.XmlReader-xmlData"></a><b><a href="source/XmlReader.html#prop-Ext.data.XmlReader-xmlData">xmlData</a></b> : XMLDocument<div class="mdesc">After any data loads/reads, the raw XML Document is available for further custom processing.</div></td><td class="msource">XmlReader</td></tr></tbody></table><a id="Ext.data.XmlReader-methods"></a><h2>Public Methods</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Method</th><th class="msource-header">Defined By</th></tr><tr class="method-row expandable"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.XmlReader-XmlReader"></a><b class="constructor"><a href="source/XmlReader.html#cls-Ext.data.XmlReader">XmlReader</a></b><span class="openparen">(&nbsp;</span><span title="Required" class="required">Object&nbsp;meta</span><span class="comma">,&nbsp;</span><span title="Required" class="required">Object&nbsp;recordType</span><span class="closeparen">&nbsp;)</span><div class="mdesc"><div class="short">Create a new XmlReader.</div><div class="long">Create a new XmlReader.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>meta</code> : Object<div class="sub-desc">Metadata configuration options</div></li><li><code>recordType</code> : Object<div class="sub-desc">Either an Array of field definition objects as passed to
<a href="output/Ext.data.Record.html#Ext.data.Record-create" ext:member="create" ext:cls="Ext.data.Record">Ext.data.Record.create</a>, or a Record constructor object created using <a href="output/Ext.data.Record.html#Ext.data.Record-create" ext:member="create" ext:cls="Ext.data.Record">Ext.data.Record.create</a>.</div></li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">XmlReader</td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.DataReader-isData"></a><b class="method"><a href="source/DataReader.html#method-Ext.data.DataReader-isData">isData</a></b><span class="openparen">(&nbsp;</span><span title="Required" class="required">Object&nbsp;data</span><span class="closeparen">&nbsp;)</span><span class="colon">&nbsp;:&nbsp;</span><span class="return">Boolean</span><div class="mdesc"><div class="short">Returns true if the supplied data-hash looks and quacks like data.  Checks to see if it has a key
corresponding to id...</div><div class="long">Returns true if the supplied data-hash <b>looks</b> and quacks like data.  Checks to see if it has a key
corresponding to idProperty defined in your DataReader config containing non-empty pk.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>data</code> : Object<div class="sub-desc"></div></li></ul><strong>Returns:</strong><ul><li><code>Boolean</code><div class="sub-desc"></div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.data.DataReader.html#isData" ext:member="#isData" ext:cls="Ext.data.DataReader">DataReader</a></td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.XmlReader-read"></a><b class="method"><a href="source/XmlReader.html#method-Ext.data.XmlReader-read">read</a></b><span class="openparen">(&nbsp;</span><span title="Required" class="required">Object&nbsp;response</span><span class="closeparen">&nbsp;)</span><span class="colon">&nbsp;:&nbsp;</span><span class="return">Object</span><div class="mdesc"><div class="short">This method is only used by a DataProxy which has retrieved data from a remote server.</div><div class="long">This method is only used by a DataProxy which has retrieved data from a remote server.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>response</code> : Object<div class="sub-desc">The XHR object which contains the parsed XML document.  The response is expected
to contain a property called <tt>responseXML</tt> which refers to an XML document object.</div></li></ul><strong>Returns:</strong><ul><li><code>Object</code><div class="sub-desc">records A data block which is used by an {@link Ext.data.Store} as
a cache of Ext.data.Records.</div></li></ul></div></div></div></td><td class="msource">XmlReader</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.XmlReader-readRecords"></a><b class="method"><a href="source/XmlReader.html#method-Ext.data.XmlReader-readRecords">readRecords</a></b><span class="openparen">(&nbsp;</span><span title="Required" class="required">Object&nbsp;doc</span><span class="closeparen">&nbsp;)</span><span class="colon">&nbsp;:&nbsp;</span><span class="return">Object</span><div class="mdesc"><div class="short">Create a data block containing Ext.data.Records from an XML document.</div><div class="long">Create a data block containing Ext.data.Records from an XML document.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>doc</code> : Object<div class="sub-desc">A parsed XML document.</div></li></ul><strong>Returns:</strong><ul><li><code>Object</code><div class="sub-desc">records A data block which is used by an {@link Ext.data.Store} as
a cache of Ext.data.Records.</div></li></ul></div></div></div></td><td class="msource">XmlReader</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.XmlReader-readResponse"></a><b class="method"><a href="source/XmlReader.html#method-Ext.data.XmlReader-readResponse">readResponse</a></b><span class="openparen">(&nbsp;</span><span title="Required" class="required">String&nbsp;action</span><span class="comma">,&nbsp;</span><span title="Required" class="required">Object&nbsp;response</span><span class="closeparen">&nbsp;)</span><span class="colon">&nbsp;:&nbsp;</span><span class="return">Ext.data.Response</span><div class="mdesc"><div class="short">Decode an XML response from server.</div><div class="long">Decode an XML response from server.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>action</code> : String<div class="sub-desc">[<a href="output/Ext.data.Api.html#Ext.data.Api-actions" ext:member="actions" ext:cls="Ext.data.Api">Ext.data.Api.actions</a> create|read|update|destroy]</div></li><li><code>response</code> : Object<div class="sub-desc">HTTP Response object from browser.</div></li></ul><strong>Returns:</strong><ul><li><code>Ext.data.Response</code><div class="sub-desc">An instance of {@link Ext.data.Response}</div></li></ul></div></div></div></td><td class="msource">XmlReader</td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.DataReader-realize"></a><b class="method"><a href="source/DataReader.html#method-Ext.data.DataReader-realize">realize</a></b><span class="openparen">(&nbsp;</span><span title="Required" class="required">Record/Record[]&nbsp;record</span><span class="comma">,&nbsp;</span><span title="Required" class="required">Object/Object[]&nbsp;data</span><span class="closeparen">&nbsp;)</span><span class="colon">&nbsp;:&nbsp;</span><span class="return">void</span><div class="mdesc"><div class="short">Used for un-phantoming a record after a successful database insert.  Sets the records pk along with new data from ser...</div><div class="long">Used for un-phantoming a record after a successful database insert.  Sets the records pk along with new data from server.
You <b>must</b> return at least the database pk using the idProperty defined in your DataReader configuration.  The incoming
data from server will be merged with the data in the local record.
In addition, you <b>must</b> return record-data from the server in the same order received.
Will perform a commit as well, un-marking dirty-fields.  Store's "update" event will be suppressed.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>record</code> : Record/Record[]<div class="sub-desc">The phantom record to be realized.</div></li><li><code>data</code> : Object/Object[]<div class="sub-desc">The new record data to apply.  Must include the primary-key from database defined in idProperty field.</div></li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource"><a href="output/Ext.data.DataReader.html#realize" ext:member="#realize" ext:cls="Ext.data.DataReader">DataReader</a></td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.data.DataReader-update"></a><b class="method"><a href="source/DataReader.html#method-Ext.data.DataReader-update">update</a></b><span class="openparen">(&nbsp;</span><span title="Required" class="required">Record/Record[]&nbsp;rs</span><span class="comma">,&nbsp;</span><span title="Required" class="required">Object/Object[]&nbsp;data</span><span class="closeparen">&nbsp;)</span><span class="colon">&nbsp;:&nbsp;</span><span class="return">void</span><div class="mdesc"><div class="short">Used for updating a non-phantom or "real" record's data with fresh data from server after remote-save.
If returning d...</div><div class="long">Used for updating a non-phantom or "real" record's data with fresh data from server after remote-save.
If returning data from multiple-records after a batch-update, you <b>must</b> return record-data from the server in
the same order received.  Will perform a commit as well, un-marking dirty-fields.  Store's "update" event will be
suppressed as the record receives fresh new data-hash<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>rs</code> : Record/Record[]<div class="sub-desc"></div></li><li><code>data</code> : Object/Object[]<div class="sub-desc"></div></li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource"><a href="output/Ext.data.DataReader.html#update" ext:member="#update" ext:cls="Ext.data.DataReader">DataReader</a></td></tr></tbody></table><a id="Ext.data.XmlReader-events"></a><h2>Public Events</h2><div class="no-members">This class has no public events.</div></div>